home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / textmenu.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-10  |  1.5 KB  |  54 lines

  1. #include <stdlib.h>
  2. #include "textmenu.h"
  3.  
  4. void TextMenu::calcItemsNumber()
  5.     {
  6.     int len = 0;
  7.     for(count = 0; itemStrings[count][0] != '\0'; count++)
  8.     {
  9.     len = max(len, strlen(itemStrings[count]));
  10.     }
  11.     itemSize = loc(len, 1);
  12.     itemDistance = loc(4, 4);
  13.     }
  14. /////////////////////////
  15. void TextMenu::showItem()
  16.     {
  17.     rect where = getItemCoord();
  18.     int left = where.origin.X + 1;
  19.     int center = where.origin.Y + where.height() / 2;
  20.     settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
  21.     settextjustify(LEFT_TEXT, CENTER_TEXT);
  22.     setcolor(pColorSet->colors.ATTR_COLOR);
  23.     outtextxy(left, center, itemStrings[pos - 1]);
  24.     }
  25. ///////////////////////////
  26. void TextMenu::setItems()
  27.     {
  28.     itemStrings = global + 1;   // exclude global[0]
  29.     pos = 1;
  30.     calcConsts();
  31.     }
  32. ///////////////////////////
  33. /*
  34. void main()
  35.     {
  36.     if(!init_KNOW_HOW())
  37.         return;
  38.     setfillstyle(SOLID_FILL, pColorSet->colors.BAK_COLOR);
  39.     bar(0, 0, getmaxx(), getmaxy());
  40.  
  41.     char* LIST[] = { "1. one", "2. two", "3. three", "4. four",
  42.                      "5. five", "6. six", "7. seven", "8. eight",
  43.              "9. nine", "" };
  44.     TextMenu t(rect(10, 10, 60, 16), "window.pcy", "TEXT MENU",
  45.            "123456789", 1, 1,
  46.            LIST, rect(0, 24, 79, 25), STRING_STATUS,
  47.            LIST, NULL, FIXED, 3, SHOW_BORDER, SHOW_BORDER, 20, 21);
  48.     t.show_window();
  49.     t.exe();
  50.     t.hide();
  51.     close_KNOW_HOW();
  52.     closegraph();
  53.     }
  54. */